<template>
  <div class="vip-section">
    <div class="vip-card">
      <div class="vip-header">
        <div class="vip-title">
          <img src="@/assets/imgs/crown.svg" alt="皇冠" class="crown-icon" />
          <span class="title-text">开通谷粒卡享特权</span>
        </div>
        <div class="vip-badge">
          <img src="@/assets/imgs/vip.png" alt="VIP" class="vip-logo" />
        </div>
      </div>
      
      <div class="vip-stats">
        <div
          v-for="item in vipServiceList"
          :key="item.name"
          class="stat-item"
        >
          <div class="stat-label">{{ item.name }}</div>
          <div class="stat-value">
            <span class="value-number">{{ item.content }}</span>
            <span class="value-unit">{{ getUnit(item.name) }}</span>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
const props = defineProps({
  vipServiceList: {
    type: Array,
    default: () => []
  }
})

const getUnit = (name) => {
  switch (name) {
    case '余额':
      return '元'
    case '优惠券':
      return '张'
    case '会员特权':
      return '项'
    case '会员福利':
      return '个'
    default:
      return ''
  }
}
</script>

<style scoped>
.vip-section {
  margin: 16px 16px 20px;
}

.vip-card {
  background: linear-gradient(135deg, #2C2C2C 0%, #1A1A1A 100%);
  border-radius: 16px;
  padding: 20px;
  color: white;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  position: relative;
  overflow: hidden;
}

.vip-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.1) 0%, rgba(255, 215, 0, 0.05) 100%);
  pointer-events: none;
}

.vip-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  position: relative;
  z-index: 2;
}

.vip-title {
  display: flex;
  align-items: center;
}

.crown-icon {
  width: 20px;
  height: 20px;
  margin-right: 8px;
  filter: brightness(0) invert(1);
}

.title-text {
  font-size: 16px;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.vip-badge {
  background: rgba(255, 255, 255, 0.1);
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid rgba(255, 215, 0, 0.3);
}

.vip-logo {
  height: 16px;
  width: auto;
}

.vip-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  position: relative;
  z-index: 2;
}

.stat-item {
  text-align: center;
}

.stat-label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 8px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.stat-value {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.value-number {
  font-size: 18px;
  font-weight: 700;
  color: #FFD700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.value-unit {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
  margin-top: 2px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* 响应式设计 */
@media (max-width: 768px) {
  .vip-section {
    margin: 12px 12px 16px;
  }
  
  .vip-card {
    padding: 16px;
  }
  
  .vip-header {
    margin-bottom: 16px;
  }
  
  .title-text {
    font-size: 14px;
  }
  
  .vip-stats {
    gap: 12px;
  }
  
  .stat-label {
    font-size: 11px;
  }
  
  .value-number {
    font-size: 16px;
  }
  
  .value-unit {
    font-size: 10px;
  }
}
</style>
